<template>
    <div class="prod-table-wrap">
        <a-table :dataSource="dataSource" :columns="columns" rowKey="id" bordered class="custom-table prod-table"
            :pagination="false" :scroll="{ x: 'max-content' }" :loading="prodLoading">
            <template #bodyCell="{ text, record, column }">
                <template v-if="column.key === 'operation'">
                    <a-radio :checked="selectedId === record.id" @change="$emit('rowSelect', record.id)">选择</a-radio>
                </template>
                <template v-else>{{ text }}</template>
            </template>
        </a-table>
    </div>
</template>

<script setup lang="ts">
defineProps<{
    dataSource: any[];
    columns: any[];
    prodLoading: boolean;
    selectedId: number | null;
}>();
defineEmits<{ (e: "rowSelect", id: number): void }>();
</script>
